package com.weilive.core.protocol.json;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.weilive.core.protocol.PacketError;

public abstract class JsonRequestHandler
{
    
    protected static Logger log = LoggerFactory.getLogger(JsonRequestHandler.class);
    public abstract Class<?> getRequestType();
    
    public abstract Class<?> getResponseType();
    
    public abstract JsonResponse handleRequest(JsonRequest request) throws Exception;
    
    public JsonResponse createErrorResponse(PacketError error) {
        return JsonResponse.create(error, getResponseType());
    }
    public JsonResponse createResponse(Object data) {
        return JsonResponse.create(data);
    }
}
